home *** CD-ROM | disk | FTP | other *** search
- REM Generic Scheduling program
- REM Written 5/7/86
- REM by Phil Jurgenson
- REM Compu-Serve ID 71106,155
- REM GEnie Mail PJURGENSON
- REM absolutely free if you can use it!
- REM created with ZBASIC compiler by Zedcor, Inc.
- REM portions of the resulting object code
- REM are copyrighted (c) by Zedcor, Inc.
- DEF OPEN "DATAJURG"
- DEF MOUSE 1
- REM
- REM dimension needed arrays
- REM
- DIM Boxtitle$(4)
- DIM Temp$(180)
- DIM Daynum(5)
- DIM Slot$(10,4)
- DIM Day$(5)
- DIM Timeslot$(36)
- DIM Hr$(10)
- DIM Mn$(4)
- DIM Dayslot$(5,36)
- DIM Month$(12)
- DIM Days(12)
- DIM Mo$(5)
- BREAK ON
- REM get rid of the menus
- REM
- WINDOW OFF
- MENU 2,0,0,""
- MENU 3,0,0,""
- MENU 4,0,0,""
- MENU 5,0,0,""
- REM
- REM generic initialization - days of the week
- REM
- FOR Index = 1 TO 5
- READ Day$(Index)
- NEXT Index
- DATA "Monday","Tuesday","Wednesday","Thursday","Friday"
- REM
- REM
- REM months to fill array
- REM
- FOR Index = 1 TO 12
- READ Month$(Index),Days(Index)
- NEXT Index
- DATA "January",31,"February",28,"March",31,"April",30,"May",31,"June",30
- DATA "July",31,"August",31,"September",30,"October",31,"November",30
- DATA "December",31
- REM
- REM array for daily data
- REM
- Mn$(1) = ":00":Mn$(2) = ":15":Mn$(3) = ":30":Mn$(4) = ":45"
- FOR Index = 1 TO 5
- Hr$(Index) = STR$(Index + 7)
- NEXT Index
- FOR Index = 6 TO 11
- Hr$(Index) = STR$(Index - 5)
- NEXT Index
- REM set up the 36 daily times
- FOR Index = 1 TO 10
- FOR Subindex = 1 TO 4
- Slot$(Index,Subindex) = Hr$(Index) + Mn$(Subindex)
- NEXT Subindex
- NEXT Index
- FOR Index = 1 TO 4
- Timeslot$(Index) = Slot$(1,Index)
- NEXT Index
- FOR Index = 5 TO 8
- Timeslot$(Index) = Slot$(2,Index - 4)
- NEXT Index
- FOR Index = 9 TO 12
- Timeslot$(Index) = Slot$(3,Index - 8)
- NEXT Index
- FOR Index = 13 TO 16
- Timeslot$(Index) = Slot$(4,Index - 12)
- NEXT Index
- FOR Index = 17 TO 20
- Timeslot$(Index) = Slot$(5,Index - 16)
- NEXT Index
- FOR Index = 21 TO 24
- Timeslot$(Index) = Slot$(6,Index - 20)
- NEXT Index
- FOR Index = 25 TO 28
- Timeslot$(Index) = Slot$(7,Index - 24)
- NEXT Index
- FOR Index = 29 TO 32
- Timeslot$(Index) = Slot$(8,Index - 28)
- NEXT Index
- FOR Index = 33 TO 36
- Timeslot$(Index) = Slot$(9,Index - 32)
- NEXT Index
- REM
- REM turn off error trapping - do it in the program
- State = 1
- ON ERROR GOSUB 65535
- REM read existing data file, if present
- OPEN "I",1,"schedata"
- IF ERROR <> 0 GOSUB "schederr":GOTO "shutfile"
- INPUT #1,Mone$,Done$,Yone$,Mtwo$,Dtwo$,Ytwo$
- FOR Index = 1 TO 5
- FOR Subindex = 1 TO 36
- INPUT #1,Dayslot$(Index,Subindex)
- NEXT Subindex
- NEXT Index
- "shutfile"
- CLOSE #1
- REM set coordinates to correspond with Macintosh pixel coords
- COORDINATE 511,341
- COORDINATE WINDOW
- REM display a copyright notice
- "copyright"
- WINDOW 2,"",( 105, 80)-( 385, 260), 2
- CALL MOVETO(100,20)
- TEXT 0,12,4,1
- PRINT "Scheduler"
- TEXT 0,12,0,1
- CALL MOVETO(80,40)
- PRINT "by Phil Jurgenson"
- CALL MOVETO(65,55)
- TEXT 4,9,0,1
- PRINT "(Compuserve - 71106,155)"
- CALL MOVETO(80,70)
- PRINT "(GEnie - PJURGENSON)"
- CALL MOVETO(40,85)
- PRINT "(Source code available on request)"
- TEXT 0,12,0,1
- CALL MOVETO(20,120)
- PRINT "Created with Zedcor ZBASIC Compiler"
- CALL MOVETO(65,140)
- TEXT 4,9,0,1
- PRINT "Portions of the code"
- CALL MOVETO(45,155)
- PRINT "copyright (c) 1985 by Zedcor, Inc."
- MOUSE ON
- "mpoll"
- Process = MOUSE(0)
- IF Process = 0 THEN GOTO "mpoll"
- MOUSE OFF
- WINDOW CLOSE 2
- "intro"
- REM get weekly dates, or display dates already in data file
- WINDOW 1,"",( 105, 80)-( 385, 260), 2
- CALL MOVETO(35, 20)
- TEXT 0,12,0,1
- PRINT "Please enter the week's dates:"
- TEXT 3,12,0,1
- CALL MOVETO(35, 50)
- PRINT "Monday's"
- CALL MOVETO(170, 50)
- PRINT "Friday's"
- CALL MOVETO(45, 65)
- PRINT "Date"
- CALL MOVETO(180, 65)
- PRINT "Date"
- CALL MOVETO(25,85)
- PRINT "(MM/DD/YY)"
- CALL MOVETO(165,85)
- PRINT "(MM/DD/YY)"
- EDIT FIELD 1,Mone$,( 10, 105)-( 35, 120), 3,3
- CALL MOVETO(40,117)
- PRINT "/"
- EDIT FIELD 2,Done$,(55,105)-(75,120),3,3
- CALL MOVETO(80,117)
- PRINT "/"
- EDIT FIELD 3,Yone$,(95,105)-(115,120),3,3
- EDIT FIELD 4,Mtwo$,(145,105)-(165,120),3,3
- CALL MOVETO(170,117)
- PRINT "/"
- EDIT FIELD 5,Dtwo$,(185,105)-(205,120),3,3
- CALL MOVETO(210,117)
- PRINT "/"
- EDIT FIELD 6,Ytwo$,(225,105)-(245,120),3,3
- BUTTON 1,1,"Okay",( 90, 145)-( 185, 165), 1
- Numitem = 6
- Item = 1
- "addintro"
- DIALOG ON
- EDIT FIELD Item
- "pollintro"
- Process = DIALOG(0)
- Buttonid = DIALOG(1)
- IF Process = 0 THEN GOTO "pollintro"
- IF Process = 1 THEN GOTO "getintro"
- IF Process = 2 THEN GOSUB "newfield":GOTO "addintro"
- IF (Process = 6) OR (Process = 7) THEN GOSUB "nextfield":GOTO "addintro"
- GOTO "pollintro"
- DIALOG OFF
- "getintro"
- Mone$ = EDIT$(1)
- Done$ = EDIT$(2)
- Yone$ = EDIT$(3)
- Mtwo$ = EDIT$(4)
- Dtwo$ = EDIT$(5)
- Ytwo$ = EDIT$(6)
- REM decode user input, fill arrays with month names and dates for printout
- Mo1num = VAL(Mone$)
- Day1num = VAL(Done$)
- Mo2num = VAL(Mtwo$)
- Day2num = VAL(Dtwo$)
- Week$ = Month$(Mo1num) + STR$(Day1num) + " -" + Month$(Mo2num) + STR$(Day2num)
- Max = Days(Mo1num)
- Indicator = Mo1num
- Pointer = Day1num
- FOR Index = 1 TO 5
- LONG IF Pointer > Max
- Pointer = 1
- Indicator = Indicator + 1
- END IF
- Daynum(Index) = Pointer
- Mo$(Index) = Month$(Indicator)
- Boxtitle$(Index) = Day$(Index) + ", " + Mo$(Index) + STR$(Daynum(Index))
- Pointer = Pointer + 1
- NEXT Index
- WINDOW CLOSE 1
- REM main function menu
- "main"
- WINDOW 1,"",( 100, 35)-( 379, 312), 4
- CALL MOVETO(85, 20)
- TEXT 0,12,0,1
- PRINT "Weekly Schedule"
- BUTTON 1,1,"Monday",( 15, 45)-( 99, 62), 3
- BUTTON 2,1,"Tuesday",( 15, 75)-( 100, 90), 3
- BUTTON 3,1,"Wednesday",( 15, 105)-( 108, 121), 3
- BUTTON 4,1,"Thursday",( 15, 135)-( 109, 152), 3
- BUTTON 5,1,"Friday",( 15, 165)-( 100, 180), 3
- BUTTON 6,State,"Clear Old Data",( 145, 45)-( 269, 62), 3
- BUTTON 7,1,"Save Schedule",( 145, 75)-( 265, 90), 3
- BUTTON 8,1,"Print Schedule",(145,105)-(265,120),3
- BUTTON 9,1,"Quit",( 145, 135)-( 220, 150), 3
- BUTTON 10,1,"Okay",( 100, 225)-( 184, 254), 1
- Buttonid = 1
- Oldbutton = 1
- DIALOG ON
- WHILE Buttonid <> 10
- WHILE DIALOG(0) <> 1
- WEND
- Buttonid = DIALOG(1)
- IF Buttonid > 0 AND Buttonid < 10 THEN GOSUB "getbutton"
- WEND
- DIALOG OFF
- WINDOW CLOSE 1
- ON Oldbutton GOSUB "monday","tuesday","wednesday","thursday","friday","empty","saveit","printsched","quit"
- GOTO "main"
- REM indicate which button has been clicked
- "getbutton"
- BUTTON Oldbutton,1
- BUTTON Buttonid,2
- Oldbutton = Buttonid
- RETURN
- REM move cursor to new edit field
- "newfield"
- Item = DIALOG(2)
- RETURN
- REM move cursor to next consecutive edit field
- "nextfield"
- Item = Item + 1
- IF Item > Numitem THEN Item = Numitem
- RETURN
- REM clear out arrays for new data
- "empty"
- FOR Index = 1 TO 5
- FOR Subindex = 1 TO 36
- Dayslot$(Index,Subindex) = ""
- NEXT Subindex
- NEXT Index
- State = 0
- RETURN
- REM routines to display schedule screen for each day
- "monday"
- Daynum = 1
- GOSUB "schedscreen"
- RETURN
- "tuesday"
- Daynum = 2
- GOSUB "schedscreen"
- RETURN
- "wednesday"
- Daynum = 3
- GOSUB "schedscreen"
- RETURN
- "thursday"
- Daynum = 4
- GOSUB "schedscreen"
- RETURN
- "friday"
- Daynum = 5
- GOSUB "schedscreen"
- RETURN
- REM common screen to display time slots for each day
- "schedscreen"
- WINDOW 2,"",( 0, 20)-( 511, 340), 3
- CALL MOVETO(225, 9)
- TEXT 4,9,0,1
- PRINT Boxtitle$(Daynum)
- Horiz = 5
- Vert = 25
- FOR Index = 1 TO 18
- CALL MOVETO(Horiz,Vert)
- PRINT Timeslot$(Index)
- Vert = Vert + 16
- NEXT Index
- Horiz = 250
- Vert = 25
- FOR Index = 19 TO 36
- CALL MOVETO(Horiz,Vert)
- PRINT Timeslot$(Index)
- Vert = Vert + 16
- NEXT Index
- Horiz = 50
- Vert = 15
- TEXT 4,9,0,1
- FOR Index = 1 TO 18
- EDIT FIELD Index,Dayslot$(Daynum,Index),(Horiz,Vert)-(Horiz+180,Vert+15),1
- Vert = Vert + 16
- NEXT Index
- Horiz = 295
- Vert = 15
- FOR Index = 19 TO 36
- EDIT FIELD Index,Dayslot$(Daynum,Index),(Horiz,Vert)-(Horiz+180,Vert+15),1
- Vert = Vert + 16
- NEXT Index
- BUTTON 1,1,"Done",( 235, 302)-( 290, 318), 1
- Numitem = 36
- Item = 1
- "add"
- DIALOG ON
- EDIT FIELD Item
- "poll"
- Process = DIALOG(0)
- Buttonid = DIALOG(1)
- IF Process = 0 THEN GOTO "poll"
- IF Process = 1 THEN GOTO "getit"
- IF Process = 2 THEN GOSUB "newfield":GOTO "add"
- IF (Process = 6) OR (Process = 7) THEN GOSUB "nextfield":GOTO "add"
- GOTO "poll"
- DIALOG OFF
- REM fill schedule arrays with data entered into edit fields
- "getit"
- FOR Index = 1 TO 36
- Dayslot$(Daynum,Index) = EDIT$(Index)
- NEXT Index
- WINDOW CLOSE 2
- RETURN
- REM save schedule data to disk
- "saveit"
- OPEN "O",1,"schedata"
- PRINT #1,Mone$;",";Done$;",";Yone$;",";Mtwo$;",";Dtwo$;",";Ytwo$
- FOR Index = 1 TO 5
- FOR Subindex = 1 TO 36
- PRINT #1,Dayslot$(Index,Subindex);",";
- NEXT Subindex
- NEXT Index
- CLOSE #1
- RETURN
- REM print the schedule
- "printsched"
- REM make sure printer is ready
- WINDOW 3,"",(140,115)-(335,220),2
- BEEP
- CALL MOVETO(5,15)
- TEXT 1,12,0,1
- PRINT "Make sure your printer is"
- CALL MOVETO(5,35)
- PRINT "set up . . . click the 'Okay'"
- CALL MOVETO(5,55)
- PRINT "button when you're ready."
- BUTTON 1,1,"Okay",(53,77)-(119,98),1
- DIALOG ON
- WHILE DIALOG(0) <> 1
- WEND
- DIALOG OFF
- WINDOW CLOSE 3
- REM put up message while printing
- "waitmessage"
- WINDOW 3,"",( 110, 120)-( 387, 240), 2
- CALL MOVETO(20, 30)
- TEXT 0,12,0,1
- PRINT "Go and get a cup of coffee or some-"
- CALL MOVETO(20, 55)
- PRINT "thing . . . This will probably take"
- CALL MOVETO(20, 85)
- PRINT "a little while . . ."
- TEXT 1,12,0,1
- REM loop to print 5 days
- FOR Counter = 1 TO 5
- REM set up coordinates to use with printer
- COORDINATE 630,455
- ROUTE 128
- TEXT 1,12,4,1
- REM print weekly dates
- PRINT Week$
- REM draw the boxes in the print file
- CALL MOVETO(0,35)
- CALL LINETO(240,35)
- CALL MOVETO(380,35)
- CALL LINETO(630,35)
- CALL MOVETO(0,35)
- CALL LINETO(0,455)
- CALL MOVETO(210,35)
- CALL LINETO(210,455)
- CALL MOVETO(420,35)
- CALL LINETO(420,455)
- CALL MOVETO(630,35)
- CALL LINETO(630,455)
- CALL MOVETO(0,245)
- CALL LINETO(630,245)
- CALL MOVETO(0,455)
- CALL LINETO(630,455)
- TEXT 4,9,0,1
- CALL MOVETO(245,35)
- PRINT Boxtitle$(Counter)
- REM print the schedule times
- TEXT 4,9,4,1
- Horiz = 5: Vert = 55
- FOR Spotter = 1 TO 6
- CALL MOVETO(Horiz,Vert): PRINT Timeslot$(Spotter)
- Vert = Vert + 30
- NEXT Spotter
- Horiz = 215: Vert = 55
- FOR Spotter = 7 TO 12
- CALL MOVETO(Horiz,Vert): PRINT Timeslot$(Spotter)
- Vert = Vert + 30
- NEXT Spotter
- Horiz = 425: Vert = 55
- FOR Spotter = 13 TO 18
- CALL MOVETO(Horiz,Vert): PRINT Timeslot$(Spotter)
- Vert = Vert + 30
- NEXT Spotter
- Horiz = 5: Vert = 265
- FOR Spotter = 19 TO 24
- CALL MOVETO(Horiz,Vert): PRINT Timeslot$(Spotter)
- Vert = Vert + 30
- NEXT Spotter
- Horiz = 215: Vert = 265
- FOR Spotter = 25 TO 30
- CALL MOVETO(Horiz,Vert): PRINT Timeslot$(Spotter)
- Vert = Vert + 30
- NEXT Spotter
- Horiz = 425: Vert = 265
- FOR Spotter = 31 TO 36
- CALL MOVETO(Horiz,Vert): PRINT Timeslot$(Spotter)
- Vert = Vert + 30
- NEXT Spotter
- REM print the schedule information for each day
- TEXT 4,9,0,1
- Horiz = 20: Vert = 70
- FOR Index = 1 TO 6
- CALL MOVETO(Horiz,Vert): PRINT Dayslot$(Counter,Index)
- Vert = Vert + 30
- NEXT Index
- Horiz = 230: Vert = 70
- FOR Index = 7 TO 12
- CALL MOVETO(Horiz,Vert): PRINT Dayslot$(Counter,Index)
- Vert = Vert + 30
- NEXT Index
- Horiz = 440: Vert = 70
- FOR Index = 13 TO 18
- CALL MOVETO(Horiz,Vert): PRINT Dayslot$(Counter,Index)
- Vert = Vert + 30
- NEXT Index
- Horiz = 20: Vert = 280
- FOR Index = 19 TO 24
- CALL MOVETO(Horiz,Vert): PRINT Dayslot$(Counter,Index)
- Vert = Vert + 30
- NEXT Index
- Horiz = 230: Vert = 280
- FOR Index = 25 TO 30
- CALL MOVETO(Horiz,Vert): PRINT Dayslot$(Counter,Index)
- Vert = Vert + 30
- NEXT Index
- Horiz = 440: Vert = 280
- FOR Index = 31 TO 36
- CALL MOVETO(Horiz,Vert): PRINT Dayslot$(Counter,Index)
- Vert = Vert + 30
- NEXT Index
- CLEAR LPRINT
- ROUTE 0
- REM this page is finished, do the next one
- NEXT Counter
- REM return to screen display
- COORDINATE 511,341
- COORDINATE WINDOW
- WINDOW CLOSE 3
- RETURN
- REM leave Scheduler
- "quit"
- END
- REM error trap if no data file present
- "schederr"
- Badresult = ERROR AND 255
- IF Badresult = 3 THEN GOSUB "blankem" ELSE Mon$ = STR$(Badresult)
- ERROR = 0
- RETURN
- "blankem"
- State = 0
- Mon$ = ""
- Fri$ = ""
- RETURN
-